package cn.chenzd.easyrecord.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import cn.chenzd.easyrecord.entity.Account;
import cn.chenzd.easyrecord.entity.Images;
import cn.chenzd.easyrecord.entity.InvasionRecord;
import cn.chenzd.easyrecord.entity.NumberPassword;
import cn.chenzd.easyrecord.entity.Type;

import cn.chenzd.easyrecord.db.AccountDao;
import cn.chenzd.easyrecord.db.ImagesDao;
import cn.chenzd.easyrecord.db.InvasionRecordDao;
import cn.chenzd.easyrecord.db.NumberPasswordDao;
import cn.chenzd.easyrecord.db.TypeDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig accountDaoConfig;
    private final DaoConfig imagesDaoConfig;
    private final DaoConfig invasionRecordDaoConfig;
    private final DaoConfig numberPasswordDaoConfig;
    private final DaoConfig typeDaoConfig;

    private final AccountDao accountDao;
    private final ImagesDao imagesDao;
    private final InvasionRecordDao invasionRecordDao;
    private final NumberPasswordDao numberPasswordDao;
    private final TypeDao typeDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
        accountDaoConfig.initIdentityScope(type);

        imagesDaoConfig = daoConfigMap.get(ImagesDao.class).clone();
        imagesDaoConfig.initIdentityScope(type);

        invasionRecordDaoConfig = daoConfigMap.get(InvasionRecordDao.class).clone();
        invasionRecordDaoConfig.initIdentityScope(type);

        numberPasswordDaoConfig = daoConfigMap.get(NumberPasswordDao.class).clone();
        numberPasswordDaoConfig.initIdentityScope(type);

        typeDaoConfig = daoConfigMap.get(TypeDao.class).clone();
        typeDaoConfig.initIdentityScope(type);

        accountDao = new AccountDao(accountDaoConfig, this);
        imagesDao = new ImagesDao(imagesDaoConfig, this);
        invasionRecordDao = new InvasionRecordDao(invasionRecordDaoConfig, this);
        numberPasswordDao = new NumberPasswordDao(numberPasswordDaoConfig, this);
        typeDao = new TypeDao(typeDaoConfig, this);

        registerDao(Account.class, accountDao);
        registerDao(Images.class, imagesDao);
        registerDao(InvasionRecord.class, invasionRecordDao);
        registerDao(NumberPassword.class, numberPasswordDao);
        registerDao(Type.class, typeDao);
    }
    
    public void clear() {
        accountDaoConfig.clearIdentityScope();
        imagesDaoConfig.clearIdentityScope();
        invasionRecordDaoConfig.clearIdentityScope();
        numberPasswordDaoConfig.clearIdentityScope();
        typeDaoConfig.clearIdentityScope();
    }

    public AccountDao getAccountDao() {
        return accountDao;
    }

    public ImagesDao getImagesDao() {
        return imagesDao;
    }

    public InvasionRecordDao getInvasionRecordDao() {
        return invasionRecordDao;
    }

    public NumberPasswordDao getNumberPasswordDao() {
        return numberPasswordDao;
    }

    public TypeDao getTypeDao() {
        return typeDao;
    }

}
